package com.mydesignpattern.beijing.singleton;

/**
 * 单例  懒汉模式
 * 用到的时候才加载，所以叫'懒汉'
 *
 * Created by nevermore on 17/4/4.
 */
public class SingletonLazy {

    private static SingletonLazy singletonLazy;

    private SingletonLazy(){}


    public static SingletonLazy getInstance(){
        if(singletonLazy == null){
            synchronized(SingletonLazy.class){
                if(singletonLazy == null){
                    singletonLazy = new SingletonLazy();
                }
            }

        }
        return singletonLazy;
    }



}
